package org.matrix.base
{

	public class Matrix7D extends Matrix6D
	{
		public function Matrix7D(depth:uint){super(depth); 	d7Lenght  = d6Lenght * depth;}
		
		override public function get dimensions():uint		{return 7}
		
		internal var d7Lenght:uint;
		protected var d7Index:uint;
		internal var d7Dirty:Boolean;
		internal var d7:Vector.<Vector.<Vector.<Vector.<Vector.<Vector.<Vector.<Number>>>>>>>;
		override protected function init():void
		{
			d7 = new Vector.<Vector.<Vector.<Vector.<Vector.<Vector.<Vector.<Number>>>>>>>(depth,true);
			for (var i:uint; i < depth; i++)
			{
				super.init();
				d7[i] = d6;
			}
		}
		
		override public function getElement( ... keys:Array):Number				{return d7[keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()]}
		override public function setElement(value:Number, ... keys:Array):void	{d7[keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()][keys.unshift()] = value}
		
		override public function get index():uint	{return d7Index * d5Lenght + super.index}
		
		override protected function validate():void
		{
			if (d6Dirty)
			{
				d6 = d7[d7Index];
				d6Dirty = false;
				d5Dirty = true;
			}
			return super.validate();
		}
		
		protected function d8Inc(recursive:Boolean = false):void
		{
			if (recursive)
				d7Index = 0;
			else
				throw new Error('')
		}
		final override protected function d7Inc(recursive:Boolean = false):void
		{
			if (++ d7Index == depth)
				d8Inc(d7Dirty = true);
			if (recursive)
				d6Index = 0;
		}
	}
}